package cate.game.admin.menu.pvp;

import cate.common.table.d.GDFunc;
import cate.game.GameBody;
import cate.game.admin.menu.MenuSetup;
import cate.game.play.part.PlaySide;
import cate.game.role.pvp.throne.RoleTB;
import easy.java.practice.errorcode.EcResult;

public class TBMenu extends MenuSetup {
	public TBMenu(GameBody game) {
		super("王座争霸");


		reg(game, "重置个人数据", 0, "", (role, params) -> {
					role.getPvp().throne = new RoleTB();
					role.getPvp().throne.initialize(role);
					role.getPvp().throne.onEnter();
					role.getPvp().throne.noticeUpdate();
					role.getGame().notice.message(role, "成功");
				}
		);

		reg(game, "选拔赛刷新对手时间清零", 0, "", (role, params) -> {
					role.getPvp().throne.trial.lastRefreshTime = 0L;
					role.getPvp().throne.trial.noticeUpdate();
					role.getGame().notice.message(role, "成功");
				}
		);

		reg(game, "设置段位赛星星", 1, "参数1：星星数", (role, params) -> {
					int star = toInt(params, 0, 1);
					role.getPvp().gradePvp.star = star;
					role.getPvp().gradePvp.noticeUpdate();
					role.getGame().notice.message(role, "成功");
				}
		);


		reg(game, "设置我的等级组", 1, "参数1：等级组（强行获取参赛资格）", (role, params) -> {
					int group = toInt(params, 0, 1);
					role.getPvp().throne.gmSetGroup(group);
					role.getGame().notice.message(role, "成功");
				}
		);

		reg(game, "对手库添加机器人", 2, "参数1：等级组 参数2：人数(默认256)", (role, params) -> {
					int levelGroup = toInt(params, 0, 1);
					int num = toInt(params, 1, 256);
					num = Math.min(num, 256);
					EcResult<PlaySide> r = game.fight.side.createPlaySideByRole(role, GDFunc.ADVENTURE);
					if (!r.ok()) {
						role.getGame().notice.message(role, "主线阵容构建失败");
						return;
					}
					role.getGame().pvp.throne.message.gmAddTrialRivalRobot(levelGroup, num, r.data);
					role.getGame().notice.message(role, "成功");
				}
		);


		reg(game, "选拔赛排行榜添加机器人", 2, "参数1：等级组 参数2：人数(默认128)", (role, params) -> {
					int levelGroup = toInt(params, 0, 1);
					int num = toInt(params, 1, 128);
					num = Math.min(num, 128);
					EcResult<PlaySide> r = game.fight.side.createPlaySideByRole(role, GDFunc.ADVENTURE);
					if (!r.ok()) {
						role.getGame().notice.message(role, "主线阵容构建失败");
						return;
					}
					role.getGame().pvp.throne.message.gmAddTrialRankRobot(levelGroup, num, r.data);
					role.getGame().notice.message(role, "成功");
				}
		);


	}
}
